<?php

namespace addons\csmitsm;

use think\Addons;
use app\common\library\Menu;
use addons\csmitsm\library\xcore\xcore\utils\XcConfigUtils;

/**
 * 插件
 */
class Csmitsm extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        require __DIR__ . "/config/xpMenu.php";
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete(XcConfigUtils::getAddonCode());
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable(XcConfigUtils::getAddonCode());
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable(XcConfigUtils::getAddonCode());
        return true;
    }

    // Hook文档: https://doc.fastadmin.net/developer/87.html
    public function appInit()
    {
        // $path = APP_PATH . '..' . \DIRECTORY_SEPARATOR . 'addons' . \DIRECTORY_SEPARATOR . 'csmitsm' . \DIRECTORY_SEPARATOR . 'library' . \DIRECTORY_SEPARATOR . 'composer' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';

        // require_once $path;
        

    }

    /**
     * JS 获取配置的方式 Config.csmitsm.cloginwxmp
     */
    public function configInit(&$params)
    {
        // $config = $this->getConfig();
        // $addons = XcConfigUtils::xpconfig('addons_code');
        // $params[$addons] = [
        //     'cloginwxmp' => $config['cloginwxmp'],
        //     'cloginwxoa' => $config['cloginwxoa'], 
        // ];
    }

}
